Imports BUS
Imports DTO
Public Class frmQuyDinh
    Private qd As New QuyDinhDto
    Private po As New Point
    Private Sub btnThoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThoat.Click
        Me.Close()
    End Sub

    Private Sub btnHuy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHuy.Click
        numSoTietToiDa.Value = qd.SoTietToiDa
        numTietGay.Value = qd.TietGay
        numToiDaDcHoc.Value = qd.ToiDaDuocHoc
    End Sub

    Private Sub btnMini_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMini.Click
        Me.WindowState = FormWindowState.Minimized
    End Sub

    Private Sub btnMove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMove.Click

    End Sub

    Private Sub btnMove_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        Me.Location = New Point(e.X, e.Y)
    End Sub

    Private Sub frmQuyDinh_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        qd = QuyDinhBUS.LayQuyDinh()
        numSoTietToiDa.Value = qd.SoTietToiDa
        numTietGay.Value = qd.TietGay
        numToiDaDcHoc.Value = qd.ToiDaDuocHoc
    End Sub

    Private Sub bntApDung_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntApDung.Click
        qd.SoTietToiDa = numSoTietToiDa.Value
        qd.TietGay = numTietGay.Value
        qd.ToiDaDuocHoc = numToiDaDcHoc.Value
        QuyDinhBUS.CapNhat(qd)
    End Sub

    Private Sub btnMove_MouseDown_1(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnMove.MouseDown
        po.X = e.X - Me.Location.X
        po.Y = Me.Location.Y - e.Y
    End Sub

    Private Sub btnMove_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnMove.MouseUp
        'Me.Location = New Point(e.X - po.X, po.Y + e.Y)
        po.X = 0
        po.Y = 0
    End Sub

    Private Sub btnMove_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnMove.MouseMove
        If (po.X <> 0 And po.Y <> 0) Then
            Me.Location = New Point(e.X - po.X, po.Y + e.Y)
        End If
    End Sub
End Class